﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using YooAsset.Editor;

[DisplayName("定位地址：表格")]
public class TableAddressRule : IAddressRule
{
    public string GetAssetAddress(AddressRuleData data)
    {
        string name = data.AssetPath.Split('/')[^1];
        return $"table/{name}";
    }
}

[DisplayName("定位地址：UI")]
public class UIAddressRule : IAddressRule
{
    public string GetAssetAddress(AddressRuleData data)
    {
        var groupName = data.GroupName;
        var name = data.AssetPath.Split('/')[^1].Split('.')[0];
        name = $"{groupName}/{name}";
        return name.ToLower();
    }
}

[DisplayName("定位地址：场景")]
public class SceneAddressRule : IAddressRule
{
    public string GetAssetAddress(AddressRuleData data)
    {
        var groupName = data.GroupName;
        var name = data.AssetPath.Split('/')[^1].Split('.')[0];
        name = $"{groupName}/{name}";
        return name.ToLower();
    }
}

[DisplayName("定位地址：材质")]
public class MaterialAddressRule : IAddressRule
{
    public string GetAssetAddress(AddressRuleData data)
    {
        var name = data.AssetPath.Split('/')[^1].Split('.')[0];
        name = $"mat_{name}";
        return name.ToLower();
    }
}

[DisplayName("定位地址：贴图")]
public class TextureAddressRule : IAddressRule
{
    public string GetAssetAddress(AddressRuleData data)
    {
        var name = data.AssetPath.Split('/')[^1].Split('.')[0];
        name = $"tex_{name}";
        return name.ToLower();
    }
}

[DisplayName("定位地址：文件名小写")]
public class LowerNameAddressRule : IAddressRule
{
    public string GetAssetAddress(AddressRuleData data)
    {
        var name = data.AssetPath.Split('/')[^1].Split('.')[0];
        return name.ToLower();
    }
}